x86/HPET: fix race triggering ASSERT(cpu < nr_cpu_ids)
authorDavid Wang <davidwang@zhaoxin.com>
Mon, 23 Apr 2018 09:00:07 +0000 (11:00 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 23 Apr 2018 09:00:07 +0000 (11:00 +0200)
commit8c02a19230502a9522b097ee15742599091064aa
tree1a05bc21c5da78e5511b6e484157ceda97a313ce
parent1232378bd2fef45f613db049b33852fdf84d7ddf
x86/HPET: fix race triggering ASSERT(cpu < nr_cpu_ids)

CPUs may share an in-use channel. Hence clearing of a bit from the
cpumask (in hpet_broadcast_exit()) as well as setting one (in
hpet_broadcast_enter()) must not race evaluation of that same cpumask.
Therefore avoid evaluating the cpumask twice in hpet_detach_channel().
Otherwise cpumask_empty() may e.g.return false while the subsequent
cpumask_first() could return nr_cpu_ids, which then triggers the
assertion in cpumask_of() reached through set_channel_irq_affinity().

Signed-off-by: David Wang <davidwang@zhaoxin.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Juergen Gross <jgross@suse.com>
xen/arch/x86/hpet.c